package com.cqc.drawable01;

import android.content.Intent;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ScaleDrawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageView;

public class MainActivity2 extends AppCompatActivity {


    private static final String TAG = "MainActivity2";
    private ImageView iv_clip_1;
    private ImageView iv_transition_1;
    private ImageView iv_scale_1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);


        iv_transition_1 = (ImageView) findViewById(R.id.iv_transition_1);
        TransitionDrawable transition1 = (TransitionDrawable) iv_transition_1.getDrawable();
        transition1.startTransition(2000);

        iv_clip_1 = (ImageView) findViewById(R.id.iv_clip_1);
        ClipDrawable clip1 = (ClipDrawable) iv_clip_1.getDrawable();
        clip1.setLevel(5000);

        /**
         * level:裁剪量，保留的就是裁剪的那部分
         */

        iv_scale_1 =   (ImageView) findViewById(R.id.iv_scale_1);
        ScaleDrawable scale1 = (ScaleDrawable) iv_scale_1.getDrawable();
        scale1.setLevel(5000);
    }
}
